#################################################################
#author: leichen
#_fun  ：FindFriends
#################################################################
from tkinter import *
import hashlib
import time
from random import choice
import  os

LOG_LINE_NUM = 0

class MY_GUI():
    def __init__(self,init_window_name):
        self.init_window_name = init_window_name


    #设置窗口
    def set_init_window(self):
        self.init_window_name.title("找朋友")           #窗口名
        self.init_window_name.geometry('500x500+50+10')                         #290 160为窗口大小，+10 +10 定义窗口弹出时的默认展示位置
        self.init_window_name.geometry('1500x681+50+10')
        #self.init_window_name["bg"] = "pink"                                    #窗口背景色，其他背景色见：blog.csdn.net/chl0000/article/details/7657887
        #self.init_window_name.attributes("-alpha",0.9)                          #虚化，值越小虚化程度越高
        #标签
        self.init_data_label = Label(self.init_window_name, text="")
        self.init_data_label.grid(row=0, column=0)
        self.init_data_label = Label(self.init_window_name,font=("Arial",12), text="待处理数据")
        self.init_data_label.grid(row=2, column=4)
        self.result_data_label = Label(self.init_window_name,font=("Arial",12), text="输出结果")
        self.result_data_label.grid(row=2, column=13)
#        self.log_label = Label(self.init_window_name, text="日志")
 #       self.log_label.grid(row=12, column=0)
        #文本框
        self.init_data_Text = Text(self.init_window_name, width=70, height=35)  #原始数据录入框
        self.init_data_Text.grid(row=4, column=1, rowspan=20, columnspan=10)

        self.init_data_label = Label(self.init_window_name, text="111")
        self.init_data_label.grid(row=4, column=13)
        self.str_trans_to_md5_button = Button(self.init_window_name, text="",  width=10
                                            )  # 调用内部方法  加()为直接调用
        self.str_trans_to_md5_button.grid(row=1, column=11)

        self.result_data_Text = Text(self.init_window_name, width=70, height=35)  #处理结果展示
        self.result_data_Text.grid(row=4, column=13, rowspan=15, columnspan=10)
#        self.log_data_Text = Text(self.init_window_name, width=66, height=9)  # 日志框
 #       self.log_data_Text.grid(row=13, column=0, columnspan=10)
        #按钮
        self.str_trans_to_md5_button = Button(self.init_window_name, text="显示队员", bg="lightblue",font=("Arial",12), width=10,command=self.ban40)  # 调用内部方法  加()为直接调用
        self.str_trans_to_md5_button.grid(row=2, column=6)

        self.str_trans_to_md6_button = Button(self.init_window_name, text="找对手", bg="lightblue", font=("Arial",12),width=10,
                                              command=self.str_trans_to_md5)  # 调用内部方法  加()为直接调用
        self.str_trans_to_md6_button.grid(row=2, column=16)

        def ban10():
            print(self,20*"#")

        def ban20():
            print(self(20 * "#"))

        def ban40(self):
            print(40 * "#")

        def showteams(self):
            filename = 'f:\\test.txt'
            f = open(filename, "r")
            lines = f.readlines()
            x = ''

            count = len(open(filename, 'rU').readlines())
            if (int(count) % 2) != 0:
                print("为了适应比赛规则，请补齐为偶数参赛队！")
            else:
                for line in lines:
                    line = line.split(".")[-1]
                    x += line

                    # L1.append(x)

                f.close()
                # print(L1)
                print("参赛分组情况如下：")
                ban20()
                print(x)
                ban20()

                L1 = x.split()
                # print(L1)

                tmp_list = L1[:]
                L2 = []

def gui_start():
    init_window = Tk()              #实例化出一个父窗口
    ZMJ_PORTAL = MY_GUI(init_window)
    # 设置根窗口默认属性
    ZMJ_PORTAL.set_init_window()

    init_window.mainloop()          #父窗口进入事件循环，可以理解为保持窗口运行，否则界面不展示



#### define banner



gui_start()